package cn.com.smartdevices.bracelet.chart;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.text.TextPaint;

import cn.com.smartdevices.bracelet.chart.base.BarChart;

/* renamed from: cn.com.smartdevices.bracelet.chart.t */
public class DynamicShareChart extends BarChart {  //C0778t
    private int f4030a;

    public DynamicShareChart(Context context) {
        super(context);
        this.mXAxis = new C0784u(this, context);
        this.mXAxis.stroke = (int) (9.0f * this.mDensity);
        this.mMaxItemValue = 10000;
        this.mItemPadding = (float) ((int) (2.0f * this.mDensity));
        setPadding(0.0f, 0.0f, 0.0f, (float) this.mXAxis.stroke);
        this.f4030a = (int) (7.0f * this.mDensity);
    }

    class C0784u extends XAxis {
        static final int f4041a = 18;
        static final int f4042b = 1;
        float f4043c;
        Paint f4044d;
        final /* synthetic */ DynamicShareChart f4045e;

        public C0784u(DynamicShareChart c0778t, Context context) {
            super(context);
            this.f4045e = c0778t;

            this.value = f4041a;
            this.offset = f4042b;
            this.f4044d = new TextPaint();
            this.f4044d.setColor(-1);
            this.f4044d.setTextSize(6.5f * this.mDensity);
            this.f4044d.setAntiAlias(true);
        }

        protected void draw(Canvas canvas, RectF rectF, float f) { //m8729a
            Rect rect = new Rect();
            for (int i = 0; ((float) i) < ((float) this.value) * f; i += f4042b) {
                int i2 = (this.offset % this.value) + i;
                if (i2 % 2 == 0) {
                    String valueOf = String.valueOf(i2);
                    this.f4044d.getTextBounds(valueOf, 0, valueOf.length(), rect);
                    canvas.drawText(valueOf, ((((float) i) * this.f4043c) + ((this.f4043c - ((float) rect.width())) / 2.0f)) + rectF.left, (((float) (this.stroke + rect.height())) / 2.0f) + rectF.top, this.f4044d);
                }
            }
        }

        protected void onRectChanged (RectF rectF) { // m8730a
            this.f4043c = rectF.width() / ((float) this.value);
        }
    }

    protected float itemWidth (RectF rectF, BarItem c0726c) { // m8708a
        return (rectF.width() / 18.0f) - (this.mItemPadding * 2.0f);
    }

    public int getTotalHours () { // m8709a
        return 18;
    }

    public void setOffsetHour (int i) { // m8710a
        ((C0784u) this.mXAxis).offset = i;
    }

    protected float itemHeight (RectF rectF, BarItem c0726c) { // m8711b
        return c0726c.f3883b >= this.mMaxItemValue ? (rectF.height() - this.mPaddingTop) - this.mPaddingBottom : ((float) this.f4030a) + ((((float) c0726c.f3883b) / ((float) this.mMaxItemValue)) * (((rectF.height() - this.mPaddingTop) - this.mPaddingBottom) - ((float) this.f4030a)));
    }

    protected float itemOffsetX (RectF rectF, BarItem c0726c) { // m8712c
        C0784u c0784u = (C0784u) this.mXAxis;
        return ((float) (((C0805v) c0726c).f3884c - c0784u.offset)) * c0784u.f4043c;
    }
}
